<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>团队成员个人信息管理</title>

    <!-- 引入一些基本的CSS样式，提升页面外观 -->
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f9;
            color: #333;
        }
        .container {
            width: 80%;
            margin: 0 auto;
            padding: 20px;
            background-color: white;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            margin-top: 30px;
        }
        h2 {
            text-align: center;
            color: #007bff;
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            font-weight: bold;
            display: block;
            margin-bottom: 5px;
        }
        .form-group input {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
        }
        .form-group input:focus {
            border-color: #007bff;
            outline: none;
        }
        button {
            background-color: #007bff;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            width: 100%;
            transition: background-color 0.3s ease;
        }
        button:hover {
            background-color: #0056b3;
        }
        .message {
            text-align: center;
            padding: 15px;
            border-radius: 5px;
            margin-bottom: 20px;
        }
        .message.success {
            background-color: #d4edda;
            color: #155724;
        }
        .message.error {
            background-color: #f8d7da;
            color: #721c24;
        }
        .message p {
            margin: 0;
        }
    </style>
</head>
<body>

<div class="container">
    <h2>个人信息</h2>

    <!-- 显示消息提示框 -->
    <c:if test="${not empty message}">
        <div class="message ${messageType == 'success' ? 'success' : 'error'}">
            <p>${message}</p>
        </div>
    </c:if>

    <!-- 如果有用户信息，显示表单 -->
    <c:if test="${not empty user}">
        <form action="/team-member/info" method="post">
            <input type="hidden" name="userID" value="${user.userId}">

            <div class="form-group">
                <label for="nickname">用户昵称:</label>
                <input type="text" id="nickname" name="nickname" value="${user.nickname}" required>
            </div>

            <div class="form-group">
                <label for="name">姓名:</label>
                <input type="text" id="name" name="name" value="${user.name}" required>
            </div>

            <div class="form-group">
                <label for="email">邮箱:</label>
                <input type="text" id="email" name="email" value="${user.email}" required>
            </div>

            <div class="form-group">
                <label for="phoneNumber">联系方式:</label>
                <input type="text" id="phoneNumber" name="phoneNumber" value="${user.phoneNumber}" required>
            </div>

            <div class="form-group">
                <label for="researchDirection">研究方向:</label>
                <input type="text" id="researchDirection" name="researchDirection" value="${user.researchDirection}" required>
            </div>

            <div class="form-group">
                <label for="academicBackground">学术背景:</label>
                <input type="text" id="academicBackground" name="academicBackground" value="${user.academicBackground}" required>
            </div>

            <div class="form-group">
                <label for="researchAchievements">科研成果:</label>
                <input type="text" id="researchAchievements" name="researchAchievements" value="${user.researchAchievements}" required>
            </div>

            <button type="submit">保存修改</button>
        </form>
    </c:if>
</div>

</body>
</html>
